package com.tencreat.common.core.utils;

import com.tencreat.common.core.enums.QueueEnum;
import com.tencreat.common.entity.ImMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 描述信息
 */

@Component
@Slf4j
public class RabbitSendUtils {
    @Resource
    private RabbitTemplate rabbitTemplate;

    /****
     * 发送消息
     */
    public void sendMessage(ImMessage message){
        //给延迟队列发送消息
        rabbitTemplate.convertAndSend(QueueEnum.QUEUE_MESSAGE.getExchange(), QueueEnum.QUEUE_MESSAGE.getRouteKey(), message);
    }
}
